<template>
	<view class="">
		<ls-page title='首页' :hidden="true"   :userIdentity='0' leftIcon='' :autoBack='false'>
			<view class="home-container">
				<view class="top-contianr">
					<image class="meng-top" src="https://oss.jtmckj.com/h5-uniapp/zttt/tabr-icon/i_icon_meng_top.png" mode="" />
					<image class="banner" v-if="shopInfo?.miniBackgroundImage" :src="shopInfo?.miniBackgroundImage" mode="" />
					<image class="banner" v-else src="https://oss.jtmckj.com/h5-uniapp/zttt/tabr-icon/banner.png" mode="" />
					<image class="meng-bottom" src="https://oss.jtmckj.com/h5-uniapp/zttt/tabr-icon/i_icon_meng_bot1.png" mode="" />
				</view>
				<view class="top-content">
					<view class="content-box">
						<view class="home-wifi">
							<!-- <view class="home-wifi-button">
							<image class="home-wifi-image" src="https://oss.jtmckj.com/wmp/images/home/index/i_icon_wifi.png" mode="aspectFill"> </image>
							<text class="home-wifi-text">一键链接</text>
						</view> -->
						</view>
						<view class="title-flex spe">
							<view class="title" @click="onLocation">
								<view class="title-icon"></view>
								<view class="addres-text">
									{{baseConfig?.orgAddress ? baseConfig.orgAddress : ''}}
								</view>
							</view>
							<view class="orgecode" v-if="storeTableInfo">桌号：{{storeTableInfo.name}}</view>
						</view>
						<view class="flex-1-img">
							<view class="item" @click="SacnOrder">
								<image class="item-left" src="https://oss.jtmckj.com/h5-uniapp/zttt/home/i_icon_order.png"
									mode="" />
								<view class="item-right">
									<view class="item-right-top">
										堂食
									</view>
									<view class="item-right-bottom">
										Dine in service
									</view>
									<view class="orgecode" v-if="storeTableInfo">{{storeTableInfo.name}}</view> 
								</view>
							</view>
							
							<view class="item" @click="Takeout" style="">
								<image class="item-left" src="https://oss.jtmckj.com/h5-uniapp/zttt/home/i_icon_yd.png"
									mode="" />
								<view class="item-right">
									<view class="item-right-top">
										外卖
									</view>
									<view class="item-right-bottom">
										Takeout
									</view>
								</view>
							</view>
						</view>
						<view class="title-flex">
							<view class="title">欢迎光临！</view>
							<view class="call" @click="callShow = true">
								<image class="kfimg" src="https://oss.jtmckj.com/h5-uniapp/zttt/i_icon_call.png"
									mode="" />
								<view class="call-title">
									客官请吩咐
								</view>
							</view>
						</view>

						<view class="flex-2-img">
							<view class="left-box">
								<view class="itemSpe" @click="topath('/subpkg/view/centerStore/centerStore')">
									<image class="item-top" src="https://oss.jtmckj.com/h5-uniapp/zttt/home/i_icon_store.png"
										mode="" />
									<view class="item-center">储值</view>
									<view class="item-bottom">Member recharge</view>
								</view>
								<view class="item spe" style="height:120rpx" @click="toOther('优惠商城')">
									<image class="item-left" src="https://oss.jtmckj.com/h5-uniapp/zttt/home/i_icon_gift.png"
										mode="" />
									<view class="item-right">
										<view class="item-right-top">
											优惠商城
										</view>
										<view class="item-right-bottom">
											Points mall
										</view>
									</view>
								</view>
							</view>
							<view class="right-box" @click.stop="showWine = true">
								<view class="item spe">
									<image class="item-left" src="https://oss.jtmckj.com/h5-uniapp/zttt/home/i_icon_coupon.png"
										mode="" />
									<view class="item-right">
										<view class="item-right-top">
											存取酒
										</view>
										<view class="item-right-bottom">
											Storage or retrieval
										</view>
									</view>
								</view>
								<view class="item spe" @click.stop="cooperate">
									<image class="item-left" src="https://oss.jtmckj.com/h5-uniapp/zttt/home/hz-png.png"
										mode="" />
									<view class="item-right">
										<view class="item-right-top">
											合作股东
										</view>
										<view class="item-right-bottom">
											Cooperate
										</view>
									</view>
								</view>
								<view class="item spe" @click.stop="topath('/subpkg/view/feedBack/feedBack')">
									<image class="item-left" src="https://oss.jtmckj.com/h5-uniapp/zttt/home/i_icon_feed.png"
										mode="" />
									<view class="item-right">
										<view class="item-right-top">
											投诉与建议
										</view>
										<view class="item-right-bottom">
											Feedback on opinions
										</view>
									</view>
								</view>
							</view>
						</view>
						<view class="pz-img-box">
							<scroll-view class="scroll-view" scroll-x="true">
								<image style="border-radius: 16rpx;" v-for="(v,k) in shopInfo?.bottomList" @click="toAdvOther(v)" :key="k"
									:src="v.carouselPic" mode="widthFix" />
							</scroll-view>
						</view>
					</view>
				</view>
			</view>
		</ls-page>
		<!-- 存取酒 -->
		<x-popup position="center" :show="showWine" :closeIcon="true" :closeOnClickOverlay="true"
			@update:show="showWine = $event">
			<view class="popup-wine">
				<view class="popup-wine-title">当前桌台：{{storeTableInfo.name}}</view>
				<view style="height:60rpx"></view>
				<view class="popup-wine-control">
					<view class="popup-wine-btn" bind:tap="onWineThrottle" @click="onWine('set')">我要寄存</view>
					<view class="popup-wine-btn" bind:tap="onWineThrottle" @click="onWine('get')">我要取酒</view>
				</view>
			</view>
		</x-popup>
		<!-- 呼叫服务 -->
		<x-popup position="center" :show="callShow" :closeIcon="true" :closeOnClickOverlay="true" @close="customService"
			@update:show="callShow = $event">
			<view class="popup-wine">
				<view class="popup-wine-top">
					<view class="top-title" style="color:var(--maincolorf1)">
						当前桌台：{{storeTableInfo.name}}
					</view>
					<!-- <view class="top-value">
				      {{table?table:''}}
				    </view> -->
				</view>
				<view style="height:60rpx"></view>
				<view class="popup-wine-control">
					<view class="popup-wine-btn" @click="onCall('get')">呼叫</view>
					<view class="popup-wine-btn" @click="onCall('set')">扫码呼叫</view>
				</view>
			</view>
		</x-popup>
		<x-popup position="center" :show="activityShow" :closeOnClickOverlay="true" @close="activityShow = false">
			<view class="activityShow-content">
				<view class="activityShow-title" style="color:var(--maincolorf1)">
					{{shopInfo.sendCouponRemark}}
				</view>
				<view style="height:60rpx"></view>
				<view class="activityShow-btn" @click.stop="topath('优惠券')">
					快去领取吧
				</view>
			</view>
		</x-popup>
		<x-popup class="adv-popup" position="center" v-if="shopInfo.headerPicture" :show="showAdv" :closeOnClickOverlay="true"
			@close="showAdv = false" closeImag="https://oss.jtmckj.com/h5-uniapp/qnig/my/close-write.png">
			<image @click.stop="showAdv = false" class="close"
				src="https://jtmc.oss-cn-hangzhou.aliyuncs.com/wmp/qnjg/common/i_close.png"></image>
			<!-- <image @click="topath('/subpkg/view/centerStore/centerStore')" class="wh100"
				src="https://jtmc.oss-cn-hangzhou.aliyuncs.com/wmp/qnjg/common/i_adv.jpg"></image> -->
			<image @click="topath('/subpkg/view/centerStore/centerStore')" class="wh100"
				:src="shopInfo.headerPicture"></image>
		</x-popup>
		<!-- 选择人数 -->
		<x-popup class="pesron-popup" position="center"  :show="showPeople" :closeOnClickOverlay="true"
			@close="showPeople = false" closeImag="https://oss.jtmckj.com/h5-uniapp/qnig/my/close-write.png">
	        <view class="popup-container-people">
	          <!-- 顶部标题 -->
	          <view class="popup-container-header">选择人数</view>
	        
	          <!-- 主体部分：人数选择 -->
	          <view class="popup-container-main" @tap="numSelect">
	            <view 
	              class="main-item" 
	              :id="v.value" 
	              :style="{
	                color: tableNum == v.value ? '#ffffff' : '#212121',
	                background: tableNum == v.value ? '#212121' : '#f2f2f2'
	              }" 
	              v-for="(v, k) in btnList" 
	              :key="k"
	            >
	              {{ v.value }}
	            </view>
	          </view>
	        
	          <!-- 输入框占位 -->
	          <view style="height: 40rpx;" v-if="isShowInp"></view>
	        
	          <!-- 输入框 -->
	          <view v-if="isShowInp">
	            <van-field 
	              v-model="inpValue" 
	              placeholder="请输入人数" 
	              :border="false" 
	              @change="onChange" 
	              type="digit" 
	            />
	          </view>
	        
	          <!-- 输入框下方间距 -->
	          <view style="height: 60rpx;" v-if="isShowInp"></view>
	        
	          <!-- 底部按钮 -->
	          <view class="popup-container-footer">
	            <!-- 取消按钮注释掉 -->
	            <view class="footer-left" @tap="showPeople = false">取消</view>
	            <view class="footer-right" @tap="peopleConfirm">确认</view>
	          </view>
	        </view>
		</x-popup>
		
	</view>



</template>

<script setup>
	import { onLoad, onReachBottom, onPullDownRefresh, onShow, onHide, onPageScroll } from '@dcloudio/uni-app';
	import { ref } from 'vue';
	import { initStatusBarHeight } from "@/until/tools.js"
	import { HFiveAppObjProcess, HFiveMemberAppObjProcess, GetMinimsgTemplate } from '@/api/public.js'
	import { getWeChatJsSDKConfig, _ExtractParamsFromPath, initTableInfoFinish, initTableInfo, updateTableInfo } from '@/until/tools.js'
	import wx from "weixin-js-sdk";
	import { useTableStore } from '@/store/table.js';

	// -------------------------------------------------------初始化数据-----------------------------------------------------
	let shopInfo = uni.getStorageSync('shopInfo') //门店信息
	const userInfo = uni.getStorageSync('userInfo') //用户信息
	const tableInfo = uni.getStorageSync('tableInfo') //桌台信息 
	const callForm = ref({
		memberMsgType: "", // 001 呼叫服务员  002 申请存酒
		memberName: "",
		memberMobile: "",
		roomCode: "",
	}) 
	const navbarHeight = computed(() => {
		return initStatusBarHeight() || 200;
	}); 
	const storeTableInfo = ref({
		code:'',
		name:''
	})
	const BottomList = ref([ ]);
	const address = ref('')
	const toPing = () => {
		console.log('跳转到 Ping 页面');
	};

	const globalData = ref({})

	let params = ref({
		brandCode: '', //品牌必传
		org: '', // 门店必传
		link: '', // 调转的小程序path必传
		code: '',
		name: '',
		version: 'trial', //  trial 为体验版  release 正式版
	})
     
	const SDKConfig = ref({})

	const tableName = ref("") // 当前房台
	const tableCode = ref("") // 当前房台编号
	// -------------------------------------------------------初始化数据-----------------------------------------------------

	const topath = (url) => {
		if(url == '优惠券') {
			activityShow.value = false
			uni.switchTab({
				url: '/pages/coupon/index'
			})
		}
		showAdv.value = false
		uni.navigateTo({
			url: url
		})
	}

	//----------------------------------------------------------------------------点单扫码----------------------------------------------------------------------
	
	
	
	const SacnOrder = async () => {
		
		if (shopInfo && shopInfo.isCloseMiniOrder) {
			uni.showToast({ title: "门店已关闭点单功能", icon: "none" });
			return
		}
		
			  //1.获取当前房台
			 let res = uni.getStorageSync('tableInfo')
			  if (res && res.code) {  
				if(shopInfo && shopInfo.isOpenRoom) {
					storeTableInfo.value = await initTableInfo()
					console.log(storeTableInfo.value);
					if(storeTableInfo.value && storeTableInfo.value.consumeCode){
						uni.navigateTo({
							url: '/pagesOrder/view/goods/index'
						})
					}else{
						showPeople.value = true
					}
				       
				}else{
					uni.navigateTo({
						url: '/pagesOrder/view/goods/index'
					})
				}
			  	
			  	
			  } else {
			  	// // 测试
			  	// let code = '0017093'
			  	// updataTableFun(code)
			  	// return
			  	uni.removeStorageSync('tableInfo')
			  	wx.config({
			  		debug: false, // 开启调试模式,
			  		appId: SDKConfig.value.appId, // 必填，企业号的唯一标识
			  		timestamp: SDKConfig.value.timestamp, // 必填，生成签名的时间戳
			  		nonceStr: SDKConfig.value.nonceStr, // 必填，生成签名的随机串
			  		signature: SDKConfig.value.signature, // 必填，签名
			  		jsApiList: ['scanQRCode'], // 必填，需要使用的JS接口列表
			  	});
			  	wx.ready((res) => {
			  		wx.scanQRCode({
			  			needResult: 1, // 默认为0，扫描结果由微信处理，1则直接返回扫描结果，
			  			scanType: ['qrCode', 'barCode'], // 可以指定扫二维码还是一维码，默认二者都有
			  			success: function(res) {
			  				if (res.resultStr) {
			  					const options = _ExtractParamsFromPath(res.resultStr);
			  					if (!options.code) {
			  						uni.showToast({ title: "二维码出错", icon: "none" });
			  						return
			  					} 
			  					updataTableFun(options.code) 
			  					
			  				} 
			  			},
			  			fail: function(response) {
			  				uni.showToast({ title: "请扫描正确的二维码", icon: "none" });
			  			},
			  		});
			  	}) 
			  } 
	}
	
	const Takeout = ()=>{
		uni.showToast({ title: "暂无开放外卖功能", icon: "none" });
	}
	
	const cooperate = ()=>{
		console.log(storeCard.value);
		if(storeCard.value && storeCard.value.isComSharingUser == '1'){
			uni.navigateTo({
			  url: `/subpkg/view/myPartner/sharePart/sharePart`
			})		
		}else{
			uni.navigateTo({
			  url: '/subpkg/view/myPartner/addPart/addPart',
			})
				   
		}
		 //  if(storeCard.value && storeCard.value.isComSharingUser == '1'){
			// uni.navigateTo({
			//   url: `/subpkg/view/myPartner/sharePart/sharePart`
			// })
					
		 //  }else{
			//   uni.navigateTo({
			//     url: '/subpkg/view/myPartner/addPart/addPart',
			//   })
		            
		 //  }
	}
	
	
	// 
	const updataTableFun = async(code) => { 
		console.log(code);
		let obj = {
			code:code
		}
		uni.setStorageSync('tableInfo',obj) // initTableInfo方法会更新 先存一个code就行
		const result = await updateTableInfo(code) 
		const tableInfo = await initTableInfo()
		if(shopInfo && shopInfo.isOpenRoom) {
			showPeople.value = true
		   // await RoomOpenFun()
		}else{
			uni.navigateTo({
				url: '/pagesOrder/view/goods/index'
			})
		}
		console.log('tableInfo:',tableInfo)
	}  		  

	// 扫码成功，则默认自动开台操作，如果开台失败则需联系线下服务员开台
	const RoomOpenFun = () => {
		
		let modal = {
			"functionName": "MemberRoomOpen_H5",
			"contentData": {
				"memberName": userInfo.name,
				"memberMobile": userInfo.mobile,
				"memberOpenid": userInfo.openId,
				"sex": userInfo.sex,
				"roomCode": storeTableInfo.value.code,
				"arrivedPeoperCount":arrivedPeoperCount.value
			}
		}
		HFiveMemberAppObjProcess(modal)
	}
	
	//-----------------------------------------------------选择人数----------------------------------------------------------
	const tableNum = ref('')
	const showPeople = ref(false)
	const isShowInp = ref(false)//是否显示输入框
	const inpValue = ref('')
	const arrivedPeoperCount = ref(0)
	const  btnList = ref([{
	  value: '1'
	}, {
	  value: '2'
	}, {
	  value: '3'
	}, {
	  value: '4'
	}, {
	  value: '5'
	}, {
	  value: '6'
	}, {
	  value: '7'
	}, {
	  value: '8'
	}, {
	  value: '更多'
	}])
	
	const numSelect = (e)=> {
		   console.log(e,'xascxa')
		   tableNum.value =  e.target.id
		   if (e.target.id == '更多') {
			 isShowInp.value = true
		   } else {
		     isShowInp.value = false
		   }
	}
	
	const peopleConfirm = ()=> {
		if (tableNum.value == '更多') {
		  arrivedPeoperCount.value = inpValue.value
		} else {
		  arrivedPeoperCount.value = tableNum.value
		}
		
		if (arrivedPeoperCount.value <= 0) {
		  uni.showToast({ title: "请选择正确人数谢谢", icon: "none" });
		  return
		}
		
		let res = uni.getStorageSync('tableInfo')
		if (res && res.code) {  
			uni.navigateTo({
				url: '/pagesOrder/view/goods/index'
			})
			RoomOpenFun()
		}
		
		showPeople.value = false
			console.log(tableNum.value,'inpValue')
	}
	
	// 储蓄 memRecharge
	const toMemRecharge = () => {
		params.value.link = 'memRecharge'
		console.log('点击了~储蓄');
		publicToWx()
	};

	//  优惠券 coupon
	const toCoupon = () => {
		params.value.link = 'coupon'
		console.log('点击了~优惠券');
		publicToWx()
	};

	//  存取酒 
	const toOnwine = () => {
		params.value.link = 'onwine'
		console.log('点击了~存取酒 ');
		publicToWx()
	};

	//  意见反馈 feedBack
	const toFeedBack = () => {
		params.value.link = 'feedBack'
		console.log('点击了~意见反馈 ');
		publicToWx()
	};

	// 订单  orderList
	const toOrderList = () => {
		params.value.link = 'orderList'
		console.log('点击了~tabbar订单 ');
		publicToWx()
	};

	// 我的  center
	const toCenter = () => {
		params.value.link = 'center'
		console.log('点击了~tabbar我的 ');
		publicToWx()
	};

	// 其它 other
	const toOther = (v) => {
		// params.value.link = 'other'
		// console.log('点击了~其它');
		// publicToWx()
			if(v =='优惠商城') {
					uni.navigateTo({
						url:'/pagesPointShop/view/index'
					})
				} else if(v == '拼桌') {
				uni.navigateTo({
					url:'/pagesSquare/index'
				})
			}
	};

	const baseConfig = ref(null)
	//获取初始获取门店信息
	const getBaseConfigInfo = () => {
		baseConfig.value = uni.getStorageSync('shopInfo')
		// try {
		// 	const res = await http.get('/GetBaseConfigInfos' + '?orgCode=' + params.value.org + '&brandCode=' + params.value.brandCode);
		// 	if (res.opFlag == 1) {
		// 		baseConfig.value = JSON.parse(res.content.objectList[0].rowData)
		// 		console.log(baseConfig.value, 'res.content.objectList[0].rowData')
		// 	}
		// } catch (error) {
		// 	console.error('Error:', error);
		// }
	}

	const bgColor = ref('transparent');

	// 一定要有参数 否则白瞎
	onLoad(async (options) => {
	
		params.value.brandCode = options.brd // ||  '0005'
		params.value.org = options.org // || '0018'
		params.value.link = options.link
		params.value.code = options.code
		params.value.name = options.name
		console.log('options-params', params.value)
		globalData.value = options
		// const globalData = uni.getStorageSync('globalData')
		// console.log(globalData, 'globalData')
		getBaseConfigInfo()
		getWeChatJsSDKConfig().then(resking => {
			SDKConfig.value = resking
		})
	
		getActivity()
		// getUserInfo()
	});
	const showAdv = ref(false)
	const storeCard = ref('')
	const initUserInfo = () => {
		let modal = {
			"functionName": "MemberInfo_H5",
			"contentData": {
				"memberCode": userInfo.value.code
			}
		}
		HFiveMemberAppObjProcess(modal).then(res => { 
			let result = []
			if(Array.isArray(res)){
				result = res
			}else{
				result = JSON.parse(res.data)
			}    
			storeCard.value = result.find(item => item.cardType == 2) 
			uni.setStorageSync('storeCard',storeCard.value)
			console.log(storeCard.value);
			// let result = res.content.rowData       
			// userModal.value = result.find(item => item.cardType === 2)  // 类型2 门店卡（当前只做门店卡不做品牌卡）   
			// store.SetUserInfo(userModal.value || '')   // 存储用户基础信息 
		})
	};
	onShow(async()=>{
		let res = await initTableInfoFinish() // 拉取用户桌台信息
		if (res.currentRoomName) {  
			tableCode.value = res.currentRoomCode
			uni.setStorageSync('tableInfo',{ // 存到本地
				code:res.currentRoomCode,
				name:res.currentRoomName
			})
		}else{
			uni.removeStorageSync('tableInfo')
		}
		storeTableInfo.value  = uni.getStorageSync('tableInfo') || {} // 获取本地数据
		userInfo.value = uni.getStorageSync('userInfo') // 获取用户信息
		shopInfo = uni.getStorageSync('shopInfo') //门店信息
		let toolAdv = uni.getStorageSync('showAdv')
		if (toolAdv) { // 弹一次广告就行
			showAdv.value = true
			uni.removeStorageSync('showAdv')
		} else {
			showAdv.value = false
		}
		initUserInfo() // 获取会员信息
		// storeTableInfo.value  = uni.getStorageSync('tableInfo') || {}
	})

	const callShow = ref(false)
	const showWine = ref(false)

	const customService = () => {
		console.log('11')
		callShow.value = false
	}
	const onWine = (type) => {
		if (type == "set") {
			// 存酒呼叫
			callWaiter("002", tableCode.value);

			//       GetMinimsgTemplate({ msgTrigger: '4' })
			//         .then(res => { 
			//              console.log(res.rowData,'DI')
			//           uni.requestSubscribeMessage({
			//             tmplIds: res.rowData,
			//             success(res) {

			//             },
			//             fail(res) {

			//             }
			//           });

			//         })
		} else {
			//       GetMinimsgTemplate({ msgTrigger: '4' })
			//         .then(res => {
			//           uni.requestSubscribeMessage({
			//             tmplIds: [res.rowData[3]],
			//             success(res) {

			//             },
			//             fail(res) {
			//             }
			//           });
			//         })
			userInfo.tableCode = tableCode.value;
			showWine.value = false
			// if (app.global.isMember) {
			// this.navTo("/pages/center/onWine/index");
			uni.navigateTo({
				url: '/subpkg/view/accessCohol/accessCohol'
			})
			// }


		}
	}

	// 存取酒-呼叫服务
	const callWaiter = (type, roomCode) => {
		if (!roomCode) {
			uni.showToast({ title: "请先扫码获取房台", icon: "none" });
			return
		}
		callForm.value.memberName = userInfo.name;
		callForm.value.memberMobile = userInfo.mobile;
		callForm.value.memberMsgType = type;
		callForm.value.roomCode = roomCode;
		HFiveMemberAppObjProcess({
			functionName: "CallWaiter_H5",
			contentData: callForm.value,
		}).then((res) => {
			console.log(res, 'res-----------')
			uni.showToast({ title: res.data, icon: "none" });
			showWine.value = false
			callShow.value = false
		});
	}


	// 客观吩咐-呼叫服务
	const onCall = (type) => {

		if (type == "set") {
			// uni.scanCode({
			//   success: (res) => {
			//     // 扫码成功
			//     const options = _ExtractParamsFromPath(res.result);
			//     if (!options.code) {
			//       uni.showToast({ title: "二维码出错", icon: "none" });
			//       return
			//     }
			//     // 存酒扫码
			//     callWaiter("001", options.code);
			//   },
			//   fail(res) { },
			// });
			wx.config({
				debug: false, // 开启调试模式,
				appId: SDKConfig.value.appId, // 必填，企业号的唯一标识
				timestamp: SDKConfig.value.timestamp, // 必填，生成签名的时间戳
				nonceStr: SDKConfig.value.nonceStr, // 必填，生成签名的随机串
				signature: SDKConfig.value.signature, // 必填，签名
				jsApiList: ['scanQRCode'], // 必填，需要使用的JS接口列表
			});
			wx.ready((res) => {
				wx.scanQRCode({
					needResult: 1, // 默认为0，扫描结果由微信处理，1则直接返回扫描结果，
					scanType: ['qrCode', 'barCode'], // 可以指定扫二维码还是一维码，默认二者都有
					success: function(res) {
						if (res.resultStr) {
							const options = _ExtractParamsFromPath(res.resultStr);
							if (!options.code) {
								uni.showToast({ title: "二维码出错，请联系服务开台", icon: "none" });
								return
							}
							// 存酒扫码
							callWaiter("001", options.code);
						}
					},
					fail: function(response) {
						uni.showToast({ title: "请扫描正确的二维码", icon: "none" });
					},
				});
			})

		} else {
			if (!tableCode.value) {
				uni.showToast({ title: "未选桌台，请扫码呼叫", icon: "none" });
				return;
			}
			// 呼叫
			callWaiter("001", tableCode.value);
		}
	}
	const onLocation = () => {
		uni.navigateTo({
			url: '/subpkg/view/switchStores/switchStores'
		})
	}
	const activityShow = ref(false)
	const  getActivity = ()=>{
		let shopInfo = uni.getStorageSync('shopInfo')
		if(shopInfo && shopInfo.setSendCoupon && uni.getStorageSync('NewMember')){
			  activityShow.value = true
			  uni.removeStorageSync('NewMember')
		}
	}
	// 
</script>
<style scoped lang="less">
	.top-contianr {
		height: 750rpx;
		position: absolute;
		// position: relative;
		top: 0;
		left: 0;
		width: 100%;
		z-index: 1;

		.meng-top {
			width: 100%;
			height: 200rpx;
			position: absolute;
			top: 0;
			left: 0;
			z-index: 20;
		}

		.banner {
			width: 100%;
			height: 750rpx;
			z-index: 10;
		}

		.meng-bottom {
			width: 100%;
			height: 750rpx;
			position: absolute;
			bottom: 0;
			left: 0;
			z-index: 10;
		}
	}

	.top-content {
		position: relative;
		z-index: 11;
		padding: 440rpx 0 0rpx;

		.banner {
			width: 100%;
			height: 320rpx;
		}

		.content-box {
			padding: 0 24rpx 140rpx;
             // background: #4c2a12;
			.title-flex {
				//   height: 115rpx;
				padding: 40rpx 0 20rpx;
				display: flex;
				align-items: center;
				justify-content: space-between;

				&.spe {
					.title {
						font-family: PingFang SC;
						font-weight: 500;
						font-size: 24rpx;
						color:#CBAB83;
						line-height: 24rpx;
						display: flex;
						align-items: center;

						.title-icon {
							width: 16rpx;
							height: 20rpx;
							background-image: url('https://oss.jtmckj.com/h5-uniapp/zttt/addres-icon.png');
							background-size: cover;
							background-repeat: no-repeat;
							background-position: center;
							margin-right: 8rpx;
						}

						.addres-text {
							width: 500rpx;
							white-space: nowrap;
							overflow: hidden;
							text-overflow: ellipsis;
							color: #CBAB83;
						}
					}

					.orgecode {
						font-family: PingFang SC;
						font-weight: bold;
						font-size: 32rpx;
						color:#CBAB83;
						line-height: 32rpx;
					}
				}

				.title {
					color:#CBAB83;
					font-size: 24rpx;
				}

				.orgecode {
					color:var(--maincolorf1);
					font-size: 30rpx;
				}

				.call {
					width: 200rpx;
					height: 48rpx;
					background: #CBAB83;
					border-radius: 8rpx;
					display: flex;
					align-items: center;

					.kfimg {
						width: 40rpx;
						height: 40rpx;
						margin: 0 9rpx 0 16rpx;
					}

					.call-title {
						font-family: PingFang SC;
						font-weight: 500;
						font-size: 24rpx;
						color:var(--maincolorf1);
						line-height: 24rpx;
					}
				}
			}

			.flex-1-img {
				display: flex;
				justify-content: space-between;

				.item {
					width: 340rpx;
					height: 148rpx;
				}
			}

			.title-flex-2 {
				//   height: 110rpx;
				padding: 40rpx 0 20rpx;
				display: flex;
				align-items: center;
				justify-content: flex-end;
				position: relative;

				.title2 {
					position: absolute;
					left: -24rpx;
					width: 180rpx;
					height: 48rpx;
					background-image: url('https://oss.jtmckj.com/wmp/ch/center/i_home_other.png');
					background-size: cover;
					background-position: center;
					background-repeat: no-repeat;
				}

				.kfimg {
					width: 180rpx;
					height: 48rpx;
				}
			}

			.flex-2-img {
				display: flex;
				justify-content: space-between;

				//   height: 400rpx;
				.left-box {
					display: flex;
					flex-direction: column;
					justify-content: space-between;

					.imgbg1 {
						width: 340rpx;
						height: 260rpx;
					}

					.imgbg2 {
						width: 340rpx;
						height: 120rpx;
					}
				}

				.right-box {
					display: flex;
					flex-direction: column;
					justify-content: space-between;

					.itemimg {
						width: 340rpx;
						height: 120rpx;
					}
				}
			}

		}

	}

	.item {
		display: flex;
		align-items: center;
		background: #CBAB83;
		border-radius: 16rpx;
		width: 340rpx;
		height: 160rpx;

		&.spe {
			height: 120rpx;
			margin-bottom: 20rpx;
			box-sizing: border-box;
		}

		.item-left {
			width: 60rpx;
			height: 60rpx;
			margin-right: 20rpx;
			margin-left: 60rpx;
		}

		.item-right {
			.item-right-top {
				font-family: PingFang SC;
				font-weight: bold;
				font-size: 36rpx;
				color:var(--maincolorf1);
				line-height: 36rpx;
				margin-bottom: 10rpx;
			}

			.item-right-bottom {
				font-family: PingFang SC;
				font-weight: 400;
				font-size: 16rpx;
				color: #212121;
				line-height: 16rpx;
			}
		}
	}

	.itemSpe {
		width: 340rpx;
		height: 260rpx;
		box-sizing: border-box;
		background: #CBAB83;
		border-radius: 16rpx;
		text-align: center;
		margin-bottom: 20rpx;
		padding-top: 47rpx;

		.item-top {
			width: 60rpx;
			height: 60rpx;
			margin-bottom: 31rpx
		}

		.item-center {
			font-family: PingFang SC;
			font-weight: bold;
			font-size: 48rpx;
			color:var(--maincolorf1);
			line-height: 48rpx;
			margin-bottom: 16rpx;
		}

		.item-bottom {
			font-family: PingFang SC;
			font-weight: 500;
			font-size: 20rpx;
			color: #212121;
			line-height: 20rpx;
		}
	}

	.footer-continar {
		position: fixed;
		bottom: 0rpx;
		width: 100%;
		// height: 150rpx;
		padding: 30rpx 0;
		background-color: var(--mainbaccolor22);

		.footer-tab-box {
			padding: 0 32rpx;
			display: flex;
			justify-content: space-between;
		}

		.tab-item {
			display: flex;
			flex-direction: column;
			justify-content: center;
			align-items: center;

			.tab-icon {
				width: 44rpx;
				height: 44rpx;
			}

			text {
				color: var(--maincolorf4);
				font-size: 24rpx;
			}
		}
	}

	button {
		background-color: transparent;
		border: none;
		color: inherit;
		font: inherit;
		line-height: normal;
		overflow: visible;
		outline: none;
		cursor: pointer;
		padding: 0;
		margin: 0;
	}

	button::after {
		border: none;
	}

	.button-hover {
		background-color: transparent;
	}

	.home-container {
		width: 100%;
		height: 100%;
		overflow: scroll;
		// background:red;
		background-image: url('https://oss.jtmckj.com/h5-uniapp/zttt/home-bg.png');
	   background-size: 100% 100%;
           
		.home-wrapper {
			padding: 0 24rpx;
			box-sizing: border-box;
		}

		.home-logo {
			padding-top: 105rpx;
			text-align: center;
			font-size: 0;

			&-image {
				width: 112rpx;
				height: 100rpx;
			}
		}

		.home-sublogo {
			padding-top: 34rpx;
			text-align: center;
			font-size: 0;

			&-image {
				width: 564rpx;
				height: 212rpx;
			}
		}

		.home-wifi {
			display: flex;
			justify-content: flex-end;
			padding-top: 9rpx;

			&-button {
				display: flex;
				align-items: center;
				background-color: var(--mainbaccolor19);
				padding: 8rpx 16rpx;
				font-size: 0;
				border-radius: 4rpx;
			}

			&-image {
				width: 24rpx;
				height: 24rpx;
			}

			&-text {
				font-family: PingFang SC;
				font-weight: 500;
				font-size: 24rpx;
				color: var(--maincolor);
				line-height: 24rpx;
			}
		}

		.home-main {
			// background: #000000;
			border-radius: 60rpx 60rpx 0rpx 0rpx;
			padding: 0 16rpx 140rpx;
			box-sizing: border-box;
			margin-top: 18rpx;

			&-heading {
				display: flex;
				justify-content: space-between;
				align-items: center;
				padding: 40rpx 20rpx 0rpx 40rpx;
				box-sizing: border-box;
			}

			&-user {
				display: flex;
				align-items: center;
				padding-bottom: 40rpx;
			}

			&-user__cover {
				width: 80rpx;
				height: 80rpx;
				border-radius: 50%;
				background-repeat: no-repeat;
				background-size: cover;
			}

			&-user__nickname {
				font-family: PingFang SC;
				font-weight: 500;
				font-size: 32rpx;
				color: var(--maincolor);
				line-height: 32rpx;
				padding-left: 16rpx;
				overflow: hidden;
				text-overflow: ellipsis;
				white-space: nowrap;
				width: 210rpx;
			}

			&-location {
				font-family: PingFang SC;
				font-weight: 500;
				font-size: 24rpx;
				color: var(--maincolorf6);
				line-height: 24rpx;
				padding: 28rpx 18rpx 0 22rpx;
				position: relative;
				overflow: hidden;
				/* 隐藏溢出内容 */
				white-space: nowrap;
				/* 不换行 */
				text-overflow: ellipsis;
				/* 使用省略号表示溢出内容 */

				&::before {
					content: '';
					position: absolute;
					top: 16rpx;
					left: 0;
					width: 20rpx;
					height: 100%;
					background-image: url('https://oss.jtmckj.com/wmp/images/home/index/i_icon_location.png');
					background-size: 100% auto;
					background-position: left center;
					background-repeat: no-repeat;
				}

				&::after {
					content: '';
					position: absolute;
					top: 16rpx;
					right: 0;
					width: 18rpx;
					height: 100%;
					background-image: url('https://oss.jtmckj.com/wmp/images/home/index/i_icon_into.png');
					background-size: 100% auto;
					background-position: right center;
					background-repeat: no-repeat;
				}
			}

			&-table {
				font-family: PingFang SC;
				font-weight: 500;
				font-size: 24rpx;
				color: var(--maincolorf2);
				line-height: 24rpx;
				text-align: right;
				padding: 34rpx 20rpx 12rpx 0;
			}
		}

		.home-menu {
			// flex: 1;
			margin-bottom: 20rpx;

			&-list {
				display: flex;
				justify-content: space-between;
				flex-wrap: wrap;
			}

			&-item {
				display: flex;
				background-size: 100% 100%;
				box-sizing: border-box;

				&__info {
					display: flex;
					flex-direction: column;
					justify-content: space-between;
				}

				&.primary {
					width: 324rpx;
					padding: 53rpx 0;
					background-image: url('https://oss.jtmckj.com/wmp/images/home/index/i_menu_bg_primary.png');
					margin-top: 20rpx;
					padding-left: 64rpx;

					.home-menu-item__icon {
						width: 54rpx;
						height: 54rpx;
					}

					.home-menu-item__info {
						padding-left: 16rpx;
					}

					.home-menu-item__title {
						font-family: PingFang SC;
						font-weight: bold;
						font-size: 32rpx;
						color: var(--maincolor);
						line-height: 32rpx;
					}

					.home-menu-item__subtitle {
						font-family: PingFang SC;
						font-weight: 400;
						font-size: 24rpx;
						color: var(--maincolor);
						line-height: 24rpx;
						transform: scale(0.83);
						transform-origin: left;
						white-space: nowrap;
					}
				}

				&.full {
					width: 100%;
					padding: 70rpx 0;
					background-image: url('https://oss.jtmckj.com/wmp/images/home/index/i_menu_bg_full.png');
					padding-left: 248rpx;

					.home-menu-item__icon {
						width: 60rpx;
						height: 60rpx;
					}

					.home-menu-item__info {
						padding-left: 24rpx;
					}

					.home-menu-item__title {
						font-family: PingFang SC;
						font-weight: bold;
						font-size: 36rpx;
						color: var(--maincolor);
						line-height: 36rpx;
					}

					.home-menu-item__subtitle {
						font-family: PingFang SC;
						font-weight: 400;
						font-size: 24rpx;
						color: var(--maincolor);
						line-height: 24rpx;
					}
				}
			}

			&-item__info {}

			&-item__icon {}

			&-item__title {}

			&-item__subtitle {}
		}

		.home-toPing {
			height: 100rpx;
			background-image: url('https://oss.jtmckj.com/wmp/images/home/index/i_home_toPing.png');
			background-size: 100% auto;
			background-position: right center;
			background-repeat: no-repeat;
		}
	}

	.popup-wine {
		&-title {
			font-family: PingFang SC;
			font-weight: bold;
			font-size: 36rpx;
			color:var(--maincolorf1);
			line-height: 36rpx;
			padding: 20rpx 0 0 48rpx;
		}

		&-top {
			display: flex;
			align-items: center;
			padding: 40rpx 0 0 40rpx;
			font-family: PingFang SC;
			font-weight: bold;
			font-size: 36rpx;
			color: var(--maincolor);
			line-height: 36rpx;
		}

		&-control {
			width: 460rpx;
			display: flex;
			justify-content: space-between;
			box-sizing: border-box;
			// padding: 0 48rpx 28rpx;
		}

		&-btn {
			border-radius: 16rpx;
			background: var(--mainbaccolor5) !important;
			padding: 34rpx 0;
			width: 200rpx;
			font-family: PingFang SC;
			font-weight: 500;
			font-size: 32rpx;
			color:var(--maincolorf1);
			line-height: 32rpx;
			text-align: center;
			position: relative;
			// &::after {
			// 	content: '';
			// 	position: absolute;
			// 	top: 42rpx;
			// 	right: 45rpx;
			// 	width: 12rpx;
			// 	height: 22rpx;
			// 	background-image: url('https://oss.jtmckj.com/wmp/images/common/i_triangle_right.png');
			// 	background-size: 100% auto;
			// 	background-repeat: no-repeat;
			// }
		}

		&-h2 {
			padding: 0 0 40rpx 48rpx;
			font-family: PingFang SC;
			font-weight: 500;
			font-size: 32rpx;
			color: var(--maincolor);
			line-height: 32rpx;
		}

		.van-radio__label {
			font-family: PingFang SC;
			font-weight: 500;
			font-size: 32rpx;
			color: var(--maincolor);
			line-height: 32rpx;
		}

		.van-radio-group--horizontal {
			// padding: 0 48rpx 40rpx;
			justify-content: space-between;
			padding: 0 100rpx 25rpx 48rpx;
		}

		.van-radio--horizontal {
			margin: 0;
		}

		.feedback-value {
			background: var(--mainbaccolor20);
			border-radius: 16rpx;
			padding: 25rpx 24rpx;
			display: flex;
			align-items: center;
			justify-content: space-between;
			margin: 0 48rpx;

			.value-text {
				font-family: PingFang SC;
				font-weight: 500;
				font-size: 32rpx;
				color: var(--maincolorf2);
				line-height: 32rpx;
			}

			.value-right {
				display: flex;
				align-items: center;

				.right-value {
					font-family: PingFang SC;
					font-weight: 500;
					font-size: 32rpx;
					color: var(--maincolor);
					line-height: 32rpx;
					padding-right: 16rpx;
				}

				.right-icon {
					width: 12rpx;
					height: 22rpx;
					background-image: url('https://oss.jtmckj.com/wmp/images/center/i_icon_tra-right.png');
					background-size: 100% 100%;
					background-repeat: no-repeat;
				}
			}
		}
	}

	.popup-container {
		padding-bottom: 40rpx;

		.popup-container-header {
			display: flex;
			align-items: center;
			justify-content: space-between;
			// padding: 33rpx 60rpx 32rpx;
			border-bottom: 1px solid var(--maincolorbd11);

			.header-left {
				font-family: PingFang SC;
				font-weight: 500;
				font-size: 32rpx;
				color: var(--maincolorf4);
				line-height: 32rpx;
				padding: 33rpx 60rpx 32rpx;
			}

			.header-center {
				font-family: PingFang SC;
				font-weight: bold;
				font-size: 36rpx;
				color: var(--maincolorf15);
				line-height: 36rpx;
			}

			.header-right {
				font-family: PingFang SC;
				font-weight: 500;
				font-size: 32rpx;
				color:var(--maincolorf1);
				line-height: 32rpx;
				padding: 33rpx 60rpx 32rpx;
			}
		}

		.popup-container-main {
			padding: 20rpx 24rpx 0;
			display: flex;
			align-items: center;
			justify-content: flex-start;
			flex-wrap: wrap;

			.main-item {
				background: var(--mainbaccolor21);
				border-radius: 8rpx;
				font-family: PingFang SC;
				font-weight: 500;
				font-size: 32rpx;
				color: var(--maincolor);
				line-height: 80rpx;
				text-align: center;
			}

			.van-col {
				margin-bottom: 20rpx;
			}

		}

		.popup-container-footer {
			margin: 0 24rpx 160rpx;
			background: var(--mainbaccolor20);
			border-radius: 16rpx;
			padding: 24rpx 0rpx 4rpx 24rpx;
			display: flex;
			align-items: center;
			justify-content: flex-start;
			flex-wrap: wrap;

			.footer-item {
				// width: 118rpx; 
				padding: 0 26rpx;
				height: 60rpx;
				background: var(--mainbaccolor21);
				border-radius: 8rpx;
				text-align: center;
				margin-bottom: 20rpx;
				font-family: PingFang SC;
				font-weight: 500;
				font-size: 28rpx;
				color: var(--maincolor);
				line-height: 60rpx;
				margin-right: 16rpx;
			}
		}
	}

	.popup-login {
		&-title {
			font-family: PingFang SC;
			font-weight: bold;
			font-size: 36rpx;
			color: var(--maincolorf1);
			line-height: 36rpx;
			padding: 60rpx 0 0 48rpx;
		}

		&-top {
			// display: flex;
			// align-items: center;
			padding: 60rpx 0 0 0rpx;
			font-family: PingFang SC;
			font-weight: bold;
			font-size: 36rpx;
			color: var(--maincolorf1);
			line-height: 36rpx;
		}

		.top-title {
			text-align: center;
		}

		&-control {
			display: flex;
			justify-content: space-between;
			box-sizing: border-box;
			padding: 0 48rpx 68rpx;
			text-align: center;
		}

		&-btn {
			border-radius: 16rpx;
			background: var(--mainbaccolor4);
			// border: 1px solid #212121;
			padding: 34rpx 0;
			width: 230rpx;
			font-family: PingFang SC;
			font-weight: 500;
			font-size: 32rpx;
			color: var(--maincolor);
			line-height: 32rpx;
			text-align: center;
			position: relative;

		}

		&-h2 {
			padding: 0 0 40rpx 48rpx;
			font-family: PingFang SC;
			font-weight: 500;
			font-size: 32rpx;
			color: var(--maincolor);
			line-height: 32rpx;
		}

	}

	.tab-bar {
		position: fixed;
		bottom: 0;
		width: 100%;
		z-index: 900;
		// padding-bottom: constant(safe-area-inset-bottom); // 兼容 IOS 11.2 以下
		// padding-bottom: env(safe-area-inset-bottom); // 兼容 IOS 11.2 以上
	}

	.tab-bar-list {
		width: 100%;
		background: var(--maincolor);
		pointer-events: auto;
		position: relative;
		// padding: 10rpx 0 20rpx 0;
		display: flex;
		justify-content: center;
		align-items: center;
		padding-bottom: env(safe-area-inset-bottom); // 适配iphoneX的底部
	}

	.footer-tab-box {
		width: 100%;
		padding: 0 32rpx;
		display: flex;
		justify-content: space-between;
	}

	.tab-bar-item {
		flex: 1;
		text-align: center;
		display: flex;
		justify-content: center;
		align-items: center;
		flex-direction: column;
		position: relative;
		padding: 5px 0;

		&.active {
			background-color: var(--maincolor);
		}
	}

	.tab-bar-item .tab-bar-icon {
		width: 44rpx;
		height: 44rpx;
	}

	.tab-bar-item .tab-bar-text {
		font-size: 10px;
		padding-top: 1px;
	}


	.pz-img-box {
		//   margin-top: 24rpx;
		//   width: 750rpx;
		display: flex;
		align-items: center;
		//   justify-content: space-between;
		//   overflow-x: auto;
		overflow: hidden;

		.scroll-view {
			width: 100%;
			overflow: hidden;
			white-space: nowrap;
			/* 防止换行 */
		}

		.img-box-item {
			display: inline-block;
			/* 让子项水平排列 */
			width: 100%;
			height: 120rpx;
			margin-right: 20rpx;

			// margin-right: 22rpx;
			.item-img {
				margin: 0;
				padding: 0;
				border: 0;
				display: block;
				/* 防止图片下方出现空白行 */
				height: 120rpx;
				width: 100%;
			}
		}

		image {
			width: 100%;
			height: 100%;
		}
	}
	.activityShow-content{
		text-align: center;
		min-width: 500rpx;
		.activityShow-title{
			padding-top: 10rpx;
			font-size: 36rpx;
			font-weight: bold;
			
		}
		.activityShow-btn{
			width: 280rpx;
			height: 60rpx;
			border: 4rpx solid var(--maincolorbd12);
			font-weight: bold;
			border-radius: 40rpx;
			font-family: PingFang SC;
			font-size: 32rpx;
			color: var(--maincolorf20);
			line-height: 60rpx;
			text-align: center;
			margin: 0 auto;
		}
	}
	.adv-popup {
		::v-deep {
			.u-popup__content {
				background: transparent;
			}
	
			.popup-content {
				padding: 0;
			}
		}
	
		.close {
			position: absolute;
			width: 48rpx;
			height: 48rpx;
			top: 20rpx;
			right: 20rpx;
			z-index: 10;
		}
	
		.wh100 {
			width: 600rpx;
			height: 800rpx;
			border-radius: 24rpx;
			background-size: contain;
			background-position: center;
			background-repeat: no-repeat;
		}
	}
	
	.popup-container-people {
	  // padding: 60rpx 48rpx 40rpx;
	
	  .popup-container-header {
	    font-family: PingFang SC;
	    font-weight: bold;
	    font-size: 36rpx;
	    color: var(--one--self--color);
	    line-height: 36rpx;
	    text-align: center;
	    margin-bottom: 40rpx;
	  }
	
	  .popup-container-main {
	    display: flex;
	    align-items: center;
	    justify-content: space-between;
	    flex-wrap: wrap;
	
	    .main-item {
	      width: calc(33.33% - 18rpx);
	      background: var(--one--back-color);
	      border-radius: 8rpx;
	      text-align: center;
	      padding: 23rpx 0;
	      margin-bottom: 20rpx;
	    }
	  }
	
	  .van-cell {
	    background: #f2f2f2;
	    border-radius: 16rpx;
	  }
	
	  .van-field__control {
	    color: #666666;
	  }
	
	  .popup-container-footer {
	    display: flex;
	    align-items: center;
	    justify-content: center;
	
	    .footer-left {
	      border-radius: 40rpx;
	      border: 2rpx solid #666666;
	      font-family: PingFang SC;
	      font-weight: 500;
	      font-size: 36rpx;
	      color: #666666;
	      line-height: 80rpx;
	      width: 240rpx;
	      height: 80rpx;
	      text-align: center;
		  margin-right: 25rpx;
	    }
	
	    .footer-right {
	      background: #212121;
	      border-radius: 40rpx;
	      font-family: PingFang SC;
	      font-weight: 500;
	      font-size: 36rpx;
	      color: #fff;
	      line-height: 80rpx;
	      width: 240rpx;
	      height: 80rpx;
	      text-align: center;
	    }
	  }
	}

	

</style>